from typing import List


class Solution:
    def maxIceCream(self, costs: List[int], coins: int) -> int:
        result = 0
        costs.sort()
        for i in range(len(costs)):
            coins -= costs[i]
            if coins >= 0:
                result += 1
            else:
                break
        return result
